// pages/showaddress/showaddress.js
var util = require('../../utils/util.js');
var app = getApp();
Page({
  data:{
    dialog3: {
      hidden: true,
    },
    json:"",
    ynumber:"",
    yfilename:"",
    yfilename1:"",
    yfilename2:"",
    yname:"",
    yowner:"",
    ysex:"",
    index: 0
   
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var a=options.a;
    var b=options.b;
    var aa=options.aa;
    var dd=options.dd;
    var ee=options.ee;
    var ff=options.ff;
    var jsonData=JSON.parse(a);
    
    this.setData({json:jsonData});
    this.setData({ynumber:b});
    this.setData({yfilename:aa});
    this.setData({yname:dd});
    this.setData({yowner:ee});
    this.setData({ysex:ff});
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  address:function(e){
    this.setData({ 'dialog3.hidden': false });
    /*wx.switchTab({
      url: '../../pages/unitdoor/unitdoor'
    })*/
    var that = this;
    var address = e.currentTarget.id;
    app.owner.address = address;
    app.owner.ynumber = that.data.ynumber;
    app.owner.yfilename = that.data.yfilename;
    app.owner.yname = that.data. yname;
    app.owner.yowner = that.data.yowner;
    app.owner.ysex = that.data.ysex;
    wx.request({
      url: 'https://wwl.ycws.cc/ssm/unitdoor/show', //仅为示例，并非真实的接口地址
      data: {
        'address': address
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res.data)
        that.setData({ list: res.data.list });
        //console.log(res.data.list[0].number);
        var an = res.data;
        var json = JSON.stringify(an);
        app.owner.unitdoorJson = json;
        that.setData({ 'dialog3.hidden': true })
        wx.switchTab({
          url: '../../pages/unitdoor/unitdoor'
        })
      }
    })
  }
})